package com.aaa.Implements;

import com.aaa.dao.DatabaseDao;
import com.aaa.service.SaPermissionService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 提供获取用户权限的具体方法，可以从数据库、缓存、或者....获取
 */

@Service
public class SaPermissionServiceImpl implements SaPermissionService {

    @Resource
    private DatabaseDao databaseDao;

    @Override
    public List<String> queryUserPermissions(Object userId) {

        List<String> userPermissions = databaseDao.queryPermissionsByUserId(userId);
        System.out.println("---从数据库取出数据进行定制---");
        return userPermissions;
    }

    @Override
    public List<String> queryUserRoles(Object userId) {

        List<String> userRoles = databaseDao.queryRoleByUserId(userId);
        System.out.println("---从数据库取出数据进行定制---");
        return userRoles;
    }
}
